package org.victoriest.server.service.impl;

import org.apache.log4j.Logger;
import org.jboss.netty.channel.Channel;
import org.springframework.stereotype.Service;
import org.victoriest.server.dto.LoginModel;
import org.victoriest.server.event.VictoriestEvent;
import org.victoriest.server.protocol.Protocol;
import org.victoriest.server.service.HandlerService;
import org.victoriest.server.util.MessageSender;

@Service("systemHandlerServ")
public class SystemHandlerServImpl implements HandlerService {

	protected Logger LOGGER = Logger.getLogger(getClass());

	@SuppressWarnings("rawtypes")
	@Override
	public int process(Channel e, VictoriestEvent model) {
		LOGGER.info("system handler process!" + model.getTimeStramp());
		if (model.getSource() instanceof LoginModel) {
			MessageSender.write(e, Protocol.TYPE_LOGIN_RES, "ok");
		} else {
			MessageSender.write(e, Protocol.TYPE_LOGIN_RES, "渣渣");
		}
		return 0;
	}
}
